﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using CDB.LinqModel.Data;
using CDB.LinqData;
using CDB.LinqModel;
using System.Web.Services;

public partial class CDBPage : System.Web.UI.MasterPage
{
    #region Variable Declaration
    IDataRepository _dataObject = new DataRepository();
    CDB.LinqModel.Menus menu;
    List<Menus> menus = new List<Menus>();
    Testimonial testimonial;
    List<Testimonial> testimonials = new List<Testimonial>();
    #endregion

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            fillMenus();
            //FillTestimonials();
        }
    }
    private void fillMenus()
    {
        menu = new Menus(_dataObject);
        menus = menu.GetAllMenus();

        if (menus.Count > 0)
        {
            for (int i = 0; i < menus.Count; i++)
            {
                if (!menus[i].Link.Trim().ToLower().Contains("aspx"))
                    ulNav.InnerHtml += "<li><a href=\"index.aspx?pg=" + menus[i].Link + "\">" + menus[i].Name + "</a></li>";
                else
                    ulNav.InnerHtml += "<li><a href=\"" + menus[i].Link + "\">" + menus[i].Name + "</a></li>";
            }
        }
    }
    //private void FillTestimonials()
    //{
    //    testimonial = new Testimonial(_dataObject);
    //    testimonials = testimonial.GetAllTestimonials();

    //    if (testimonials != null)
    //    {
    //        rptTestimonial.DataSource = testimonials;
    //        rptTestimonial.DataBind();
    //    }
    //}
}
